
package client;
//命令行参数
public class CmdClient {
    private String command;
    private String key;
    private String value;
    private String host;
    private int port;

    // Constructor
    public CmdClient(String[] args) {
        if (args.length < 2) {
            System.err.println("Usage:");
            System.err.println("    java -cp target/classes example.SocketClientUsage set <key> <value>");
            System.err.println("    java -cp target/classes example.SocketClientUsage get <key>");
            System.err.println("    java -cp target/classes example.SocketClientUsage rm <key>");
            System.exit(1);
        }

        this.command = args[0];
        this.key = args[1];
        this.value = args.length > 2 ? args[2] : null;
        this.host = "localhost";
        this.port =  64809;
    }

    // Getters
    public String getCommand() {
        return command;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public String getHost() {
        return host;
    }

    public int getPort() {
        return port;
    }
}